<template>
  <div>
    <el-dialog
      title="重新分派"
      :visible.sync="dialogTableVisible"
      :close-on-click-modal="false"
      width="750px">
      <el-form :model="selectForm" ref="queryForm" :inline="true">
        <el-form-item label="姓名" >
          <el-input
            v-model="selectForm.name"
            placeholder="请输入姓名"
            clearable
            size="small"
          />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="getUserList">搜索</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="loading" :data="zrrOptions" stripe
                highlight-current-row
                @current-change="handleCurrentChangeTable" >
        <el-table-column align="center" label=""  width="55">
          <template slot-scope="scope">
             <el-radio v-model="userid" :label="scope.row.userId"><span></span></el-radio>
          </template>
        </el-table-column>
        <el-table-column align="center" type="index" label="序号"  :show-overflow-tooltip="true"/>
        <el-table-column align="center" label="姓名" property="nickName" :show-overflow-tooltip="true"></el-table-column>
        <!-- <el-table-column align="center" label="性别"   property="name" :show-overflow-tooltip="true"  ></el-table-column> -->
      </el-table>
      <pagination
        :page-sizes="[5,10,20,50]"
        :page-size="selectForm.pageSize"
        :total="total"
        :page.sync="selectForm.pageNum"
        :limit.sync="selectForm.pageSize"
        @pagination="getUserList"/>


      <span slot="footer" class="dialog-footer">
        <el-button type="primary"  size="mini" @click="determine">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import { treeselect } from "@/api/system/dept";
  import {listUser,transfer} from '@/api/inventory/index'
  export default {
    name: "Role",
    data() {
      return {
        title:'',
        loading:false,
        dialogTableVisible:true,
        //产品查询数据
        selectForm:{
          pageNum: 1,
          pageSize: 5,
          name:null,
        },
        total:0,
        xuanzhong:{},
        zrrOptions:[],
        userid:null
      };
    },
    components:{

    },
    watch: {
      dialogTableVisible: function () {
        this.dialogTableVisible = true;//始终让他为true;
        this.cancel();//隐藏
      },
    },
    created() {
      this.getUserList()

    },
    methods: {
      getUserList(){
        //获取负责人列表
        listUser(this.selectForm).then((res)=>{
          if(res.code==200){
            this.zrrOptions = res.rows
            this.total = res.total
          }
        })
      },
      //确定
      determine:function(){
        if(!this.userid){
          this.$message.warning('请选择行')
          return false
        }
        
        this.$emit('chooseDepartmen',this.userid)//将submitModel的值传给父组件
      },
      //隐藏
      cancel:function(){
        this.$emit('closeDepartmen',1)

      },
      //分页
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
      },
      //表哥监听
      handleCurrentChangeTable:function (val) {
        console.log(val)
        this.xuanzhong = val

      },
    }
  };
</script>
<style >





</style>
